package com.ce.pms.charge.service;

import java.math.BigDecimal;
import java.util.List;

import com.ce.pms.charge.model.AccountDomain;
import com.ce.pms.charge.model.ChargeAccountDomain;
import com.ce.pms.charge.model.DepositAccountDO;
import com.ce.pms.charge.model.PrePayAccountDomain;
import com.ce.pms.charge.vo.AccountVO;
import com.ce.pms.common.model.SysInfo;
import com.ce.pms.customer.model.ProRightDO;
import com.ce.pms.house.model.HouseDomain;
/**
 *
 * @function 创建帐户，查询帐户余额等操作
 * @author Adama Yue
 * @CreateDate:2008-7-28
 */
public interface IAccountService {
	/**
	 * 取得给定房间当前帐户的余额
	 *@param house
	 *@return
	 * @author Adama Yue
	 * @CreateDate:上午10:09:52
	 */
	public BigDecimal getBalance(HouseDomain house);

	/**
	 * 功能描述: 查询指定总账户id的物业费用子账的余额 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-9-17  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public BigDecimal getChargeAccountBalance(Long accountId);

	/**
	 * 功能描述: 查询指定总账户id的预交款子账的余额 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-9-17  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public BigDecimal getPrePayAccountBalance(Long accountId);
	
	/**
	 * 功能描述: 查询指定总账户id的押金子账户的余额 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2009-1-8  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public BigDecimal getDepositAccountBalance(Long accountId);

	/**
	 * 功能描述: 查询指定房屋id的账户余额（所有子账户的余额绝对值之和） <br>
	 * @param houseId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-9-10  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public BigDecimal getBalance(Long houseId);

	/**
	 * 对给定房间增加一个活动帐户（含所有子帐户）
	 *@param house
	 * @author Adama Yue
	 * @CreateDate:上午10:13:56
	 */
	public AccountDomain addAccount(HouseDomain house,ProRightDO proRight, SysInfo sysInfo);

	/**
	 * 功能描述: 查询指定的房屋是否产生了费用 <br>
	 * @param house
	 * @return true 产生  false 未产生
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-9-1  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public Boolean queryHouseIsProduceCharge(HouseDomain house);

	/**
	 * 功能描述: 得到指定产权和房屋的当前有效帐户  <br>
	 * @param proRightId
	 * @param houseId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-8-26  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public AccountVO getCurrentAccountBy(Long proRightId,Long houseId);

	/**
	 * 功能描述: 得到指定产权和房屋帐户，
	 * 参数isActive如果为true，则只查询其有效账户，否则全都查询   <br>
	 * @param proRightId 产权id
	 * @param houseId 房屋id，不论管理房和产权房
	 * @param isActive
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-8-26  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public AccountVO getAccountByProRightAndHouse(Long proRightId,Long houseId,boolean isActive);

	/**
	 * 禁用帐户(前提是余额为零,否则抛异常)
	 *@param house
	 *@param proRight
	 * @author Adama Yue
	 * @CreateDate:下午02:22:52
	 */
	public void disableAccount(AccountDomain account);
	/**
	 * 激活帐户(前提是余额为零,否则抛异常)
	 *@param account
	 * @author Adama Yue
	 * @CreateDate:下午05:55:15
	 */
	public void activeAccount(AccountDomain account);

	/**
	 * 功能描述: 根据id查询总账户实体 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-9-5  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public AccountDomain getAccountDoById(Long accountId);

	/**
	 * 功能描述:取得给定房间的当前可用帐户,如有管理房未初始化帐户返回空  <br>
	 * @param house 房屋DO，将使用到其中的ID
	 * @return
	 *
	 * Create author: Adama Yue <br>
	 * Create on: 上午10:15:04  <br>
	 * Edit author:付湘辉  <br>
	 * Edit on:2009-1-6    <br>
	 * Why:修改注释     <br>
	 */
	public AccountDomain currentAccount(HouseDomain house);
	
	/**
	 * 功能描述:取得给定房间ID的当前可用帐户  <br>
	 * @param houseId 房屋ID
	 * @return
	 *
	 * Create author: 付湘辉 <br>
	 * Create on: 2009-1-6  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:    <br>
	 */
	public AccountDomain getCurrentAccount(Long houseId);

	/**
	 * 功能描述: 物理删除一个产权房的总账，
	 * <b>注意</b>：这个总账应没有产生任何费用。 <br>
	 * @param houseId 产权房id
	 * @return 暂不起作用，只作预留
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-23  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public Boolean deleteAccountByHouseId(Long houseId);

	/**
	 * 功能描述: 查询指定产权和房屋的当前有效帐户实体  <br>
	 * @param houseId 房屋id，不论管理房和产权房
	 * @param proRight 产权
	 * @return
	 *
	 * Create author: 付湘辉 <br>
	 * Create on:  <br>
	 * Edit author:2008-8-26 <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public AccountDomain currentAccount(Long houseId,ProRightDO proRight);
	/**
	 * 取得给定房间的所有历史帐户
	 *@param house
	 *@return
	 * @author Adama Yue
	 * @CreateDate:上午10:30:58
	 */
	public List<AccountDomain> getHistoryAccounts(HouseDomain house);

	/**
	 * 功能描述: 查询指定总账的收费子账户实体 <br>
	 * @param accountDo
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public ChargeAccountDomain getChargeAccountByAccount(AccountDomain accountDo);
	
	/**
	 * 功能描述: 查询指定总账的押金子账户实体 <br>
	 * @param accountDo
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2009-1-8  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public DepositAccountDO getDepositAccountByAccount(AccountDomain accountDo);

	/**
	 * 功能描述: 查询指定总账id的收费子账户实体 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public ChargeAccountDomain getChargeAccountByAccountId(Long accountId);
	
	/**
	 * 功能描述: 查询指定总账id的押金子账户实体 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public DepositAccountDO getDepositAccountByAccountId(Long accountId);

	/**
	 * 功能描述: 查询指定总账的预交款子账户实体 <br>
	 * @param accountDo
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public PrePayAccountDomain getPrePayAccountByAccount(AccountDomain accountDo);

	/**
	 * 功能描述: 查询指定总账id的预交款子账户实体 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public PrePayAccountDomain getPrePayAccountByAccountId(Long accountId);

	/**
	 * 功能描述: 锁定指定总账户下所有子账户的借货方 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public Boolean lockAccount(Long accountId);

	/**
	 * 功能描述: 解锁指定总账户下所有子账户的借货方 <br>
	 * @param accountId
	 * @return
	 *
	 * Create author:付湘辉 <br>
	 * Create on:2008-10-24  <br>
	 * Edit author:  <br>
	 * Edit on:    <br>
	 * Why:     <br>
	 */
	public Boolean unblockAccount(Long accountId);

}
